﻿using MVCT8_API.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace MVCT8_API.Controllers
{
   
    public class ValuesController : ApiController
    {
        private fashionshoppingDBEntities _Context = new fashionshoppingDBEntities();
      
        // GET api/values
        public IEnumerable<Sysuser> Get()
        {
            return _Context.Sysuser.ToList();
        }

        // GET api/values/5
        public Sysuser Get(int id)
        {

           
            return _Context.Sysuser.FirstOrDefault(x=>x.id==id);
        }

        // POST api/values
        public void Post([FromBody]Sysuser value)
        {
            _Context.Sysuser.Add(value);
            _Context.SaveChanges();
        }

        // PUT api/values/5
        public void Put(int id, [FromBody]string value)
        {

            var userObj = _Context.Users.FirstOrDefault(s => s.userid == id);
            if (true)
            {

            }
        }

        // DELETE api/values/5
        public void Delete(int id)
        {

            var userObj = _Context.Sysuser.FirstOrDefault(u => u.id == id);
            _Context.SaveChanges();
        }
    }
}
